﻿String.prototype.Trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
$(document).ready(function() {
    $("#ctl00_MainContent_txtBeian_BH").bind("blur", function() {
        if ($("#ctl00_MainContent_HiddenField1").val() == "") {
            if ($(this).val().Trim() != "" && $(this).val().Trim() != $("#ctl00_MainContent_lblBeian_BH").text()) {
                $.getJSON("../../XTWHPage/CYDWPage/AjaxTreeList.ashx", {
                    'BABH': $(this).val()
                }, function(json) {
                    $.each(json, function(i, n) {
                        if (n.toString() == "false") {
                            $("#spanBeian_BH").css("display", "");
                        }
                        else {
                            $("#spanBeian_BH").css("display", "none");
                        }
                    });
                });
            }
        }
    });
});

function popWin(selectAction, Title) {
    setTimeout(
                      function() {
    ymPrompt.win({ message: selectAction + "&DWMC=" + $("#ctl00_MainContent_txtJSDW").val(),
                              width: 760,
                              height: 500,
                              title: Title,
                              handler: null,
                              maxBtn: true,
                              minBtn: true,
                              iframe: true
                          });
                      }, 50);
    return false;
}

function removeDW() {
    //$("#ctl00_MainContent_txtJSDW").val("");
    $("#ctl00_MainContent_HidDWID").val("");
    $("#ctl00_MainContent_selectDW").html("单位关联");
    $("#ctl00_MainContent_removeDW").css("display", "none");
    $("#ctl00_MainContent_selectTable").css("display", "");
    $("#ctl00_MainContent_selectTable1").css("display", "none");
    return false;
}

function Getbh(p1, p2) {
    var obj = document.getElementById(p2);
    var WinElementPos = getWinElementPos(obj);
    var val = document.getElementById(p1);
    val.style.display = "inline";
    val.style.left = (parseInt(WinElementPos.x) - 55).toString() + "px";
    val.style.top = (parseInt(WinElementPos.y) + 12).toString() + "px";
}
function yincan(p1) {
    var val = document.getElementById(p1);
    val.style.display = "none";
}